package com.yt.order.provider;

import com.yt.order.api.interfaces.OrderNumberService;
import com.yt.order.api.interfaces.ProductService;
import com.yt.order.api.model.Product;
import com.yt.order.provider.service.impl.OrderNumberManager;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;

/**
 * Created by liujunshi on 16/1/1.
 */
public class Launcher {
    public static void main(String[] args){
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "app-context.xml" });
        context.start();

        ProductService productService = context.getBean(ProductService.class);

        Product product = productService.get(11L);
        if (product != null) {
            System.out.println(product.toString());
        }else{
            System.out.println("nulll ");
        }

        System.out.println(OrderNumberManager.nextOrderNumber(1, 1, context.getBean(OrderNumberService.class)));

        try {
            System.out.println("开始阻塞");
            System.in.read(); // 按任意键退出
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
